package cn.aixuxi.notebank.util;

import cn.hutool.core.lang.UUID;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * 类描述 类型转换工具类
 *
 * @author ruozhuliufeng
 * @version 1.0
 * @date 2020/11/15 22:45
 */
public class ConverUtils {
    /**
     * 随机数
     * @param place 定义随机数的位数
     */
    public static String randomGen(int place) {
        String base = "erwetyuioplkjhgfdsazxcvbnmQAZWSXEDCRFVTGBYHNUJMIKLOP0123456789";
        StringBuffer sb = new StringBuffer();
        Random rd = new Random();
        for (int i = 0; i < place; i++) {
            sb.append(base.charAt(rd.nextInt(base.length())));
        }
        return sb.toString();
    }

    public static boolean isEmpty(Object object) {
        if (object == null) {
            return true;
        }
        if ("".equals(object)) {
            return true;
        }
        if ("null".equals(object)) {

            return true;
        }
        return false;

    }

    public static boolean isNotEmpty(Object object) {
        if (object != null && !object.equals("") && !object.equals("null")) {
            return true;
        }
        return false;
    }

    public static List<Integer> stringToList(String[] strings) {
        List<Integer> list = new ArrayList<>();
        for (String s : strings) {
            list.add(Integer.valueOf(s));
        }
        return list;
    }
}
